#include <stdio.h>

#include "SDL\SDL.h"
#include "Game.h"
#include "MenuState.h"
#include "PlayState.h"

MenuState MenuState::m_MenuState;

void MenuState::Init()
{	
	menuSprite = NULL; // set pointer to NULL;
	menuSprite = Sprite::Load("menustate.bmp"); // load menu state bitmap
	printf("MenuState Init Successful\n");
}

void MenuState::Cleanup()
{
	printf("MenuState Clean Successful\n");
}

void MenuState::Pause()
{
	printf("MenuState Paused\n");
}

void MenuState::Resume()
{
	printf("MenuState Resumed\n");
}

void MenuState::HandleEvents(Game* game)
{
	SDL_Event event;
	
	if (SDL_PollEvent(&event)) {
		switch (event.type) {
			case SDL_QUIT:
				game->Quit();
				break;

			case SDL_KEYDOWN:
				 switch(event.key.keysym.sym){

				 case SDLK_SPACE:
					  game->ChangeState(PlayState::Instance());
					  break;
			 }
		}
	}
}


void MenuState::Update(Game* game) 
{
}

void MenuState::Draw(Game* game) 
{
   Sprite::Draw(game->GetScreen(), menuSprite, 0, 0); // we will write 
													  // GetScreen() in a second
   SDL_Flip(game->GetScreen());
}
